﻿using AutoMapper;
using GGGK.Film.Models.Dto;
using GGGK.Film.Models.Models;

namespace GGGK.Film.Api.Automapper
{
    public class DTO2POMappingProfile:AutoMapper.Profile
    {
        public DTO2POMappingProfile()
        {
            CreateMap<UserInfoDto, Base_UserInfo>();

            CreateMap<UserPostDto, Base_UserInfo>()
                .ForMember(d => d.CreateTime, s => s.MapFrom(o => DateTime.Now))
                .ForMember(d => d.Status, s => s.MapFrom(o => 1))
                .ReverseMap();
            CreateMap<UserPostDto, Base_LoginInfo>()
                .ForMember(d => d.CreateTime, s => s.MapFrom(o => DateTime.Now))
                .ForMember(d => d.Status, s => s.MapFrom(o => 1))
                .ForMember(d => d.LoginCount, s => s.MapFrom(o => 0))
                .ForMember(d => d.LoginLastTime, s => s.MapFrom(o => DateTime.Now));
            CreateMap<DictInfoPostDto, Base_DictInfo>().ReverseMap();
            CreateMap<MenuPostDto, Base_MenuInfo>().ReverseMap();
        }
    }
}
